[EP Plugin Adapter] support LoggingManager::HasDefaultLogger()#27587
Merged
[EP Plugin Adapter] support LoggingManager::HasDefaultLogger()#27587
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the EP plugin adapter logging surface to expose LoggingManager::HasDefaultLogger() (mirroring the main ORT logging API shape) so plugin EP code can query whether a default logger is available.
Changes:
- Introduce
onnxruntime::ep::adapter::LoggingManagerwithHasDefaultLogger()and move default-logger management offLogger. - Update the adapter’s
LOGS_DEFAULT_CATEGORYmacro to useLoggingManager::DefaultLogger(). - Expose
LoggingManagervia EP-specific using declarations ininclude/onnxruntime/ep/adapters.h.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| include/onnxruntime/ep/adapters.h | Exposes LoggingManager in the EP plugin adapter’s logging namespace aliases. |
| include/onnxruntime/ep/adapter/logging.h | Adds adapter LoggingManager (with HasDefaultLogger) and routes default logging macros through it. |
Comments suppressed due to low confidence (1)
include/onnxruntime/ep/adapter/logging.h:47
LoggingManager::DefaultLogger()dereferencesinstance_without checking it is initialized, which is undefined behavior if logging is used beforeCreateDefaultLogger()is called. Also,CreateDefaultLogger()overwritesinstance_without deleting/guarding against an existing logger, which can leak if called more than once. Consider matching::onnxruntime::logging::LoggingManagerbehavior: throw (or otherwise fail fast) ifinstance_is null inDefaultLogger(), and either throw ifinstance_is already set or delete/requireDestroyDefaultLogger()before re-creating.
static bool HasDefaultLogger() { return nullptr != instance_; }
static const Logger& DefaultLogger() { return *instance_; }
static void CreateDefaultLogger(const OrtLogger* logger) {
instance_ = new Logger(logger);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
guschmue
approved these changes
Mar 11, 2026
fs-eire
added a commit
that referenced
this pull request
Mar 24, 2026
### Description This PR makes it possible to build WebGPU EP as an EP API based plugin EP. #### Requirements The goal of this PR is to support both building WebGPU EP as a bundled EP and an EP API based plugin EP. This approach allows: - enabling WebGPU EP as a standalone plugin EP package for WCR usage - graceful transition for WebGPU EP as an native EP for language binding, from the bundled EP to an EP API based plugin EP - keep the existing usage (static library) working (majorly for web) #### Design & Implementation Instead of **changing** WebGPU EP from a bundled EP to an EP API based plugin EP in one shot, this PR **extend** WebGPU EP to support building as plugin EP. - add a new folder `include/onnxruntime/ep` with a bunches of header files. Those files are not WebGPU specific. They are used for: - include common defines/functions/macros for plugin EP to use - include a few "adapter" classes that takes C-API objects to simulate ORT internal classes behaviors - include a few "override" classes that simulate ORT internal classes, but using implementations that only depend on C-API - include a special base class `onnxruntime::ep::Ep` to inherit from These header files allow a compile time "switch" to the different set of types to minimize changes to existing code. Specifically, `pch.h` is required to be included as PCH to make sure the "override" to take place correctly. - add a new folder `onnxruntime/core/providers/webgpu/ep` for EP API implementation, specifically: - `api.cc`: implements `CreateEpFactories` and `ReleaseEpFactory` - `ep.cc` `ep.h`: implement class `onnxruntime::webgpu::ep::Ep` - `factory.cc` `factory.h`: implement class `onnxruntime::webgpu::ep::Factory` #### Dependencies and Prerequisites (unmerged changes are included as a part of current PR) - #26855 - #26803 - #26859 - #26879 - #26919 - #27569 - #27587 #### Missing Parts - Allow setting Global/Default EP options --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add support for
LoggingManager::HasDefaultLogger().